<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function doSearch(){
            var xhr=new XMLHttpRequest();
            var url="http://localhost/ajax/service/ajax2.php";
            xhr.open("post",url,true);
            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xhr.send("param=哈哈哈哈哈哈哈");
            setTimeout(function(){
                var text=xhr.responseText;
                console.log('text:',text);
            },1000);
        }
    </script>
</head>
<body>
    <input type="button" value="search" onclick="doSearch()" >
</body>
</html>